/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bygf.dts.gui;


import javax.swing.table.DefaultTableModel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
 *
 * @author pi
 */
public class MainJFrame extends javax.swing.JFrame {
    private static Logger logger = LogManager.getLogger(TestJFrame .class.getName());
    private void initChStatus(){
        jLabelCh1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bygf/dts/image/green1.png")));
        jLabelCh2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bygf/dts/image/green2.png")));
        jLabelCh3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bygf/dts/image/green3.png")));
        jLabelCh4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bygf/dts/image/green4.png")));
    }
    /**
     * Creates new form MainJFrame
     */
    public MainJFrame() {
        initComponents();
        setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
        jPanelHistory.setVisible(false);
        jPanelSetParam.setVisible(false);
        initChStatus();
        DefaultTableModel dtm = (DefaultTableModel)jTableAlarm.getModel();
        for(int i=0;i<50;i++){
            dtm.insertRow(i,new String[]{"1","2"});
        }
        
//        ImageIcon icon = new ImageIcon("resource\\set.png");
//        jButton1.setIcon(icon);

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPopupMenu1 = new javax.swing.JPopupMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jPanelControl = new javax.swing.JPanel();
        jButtonStop = new javax.swing.JButton();
        jButtonStart = new javax.swing.JButton();
        jScrollPaneAlarm = new javax.swing.JScrollPane();
        jTableAlarm = new javax.swing.JTable();
        jPanelCh = new javax.swing.JPanel();
        jLabelCh1 = new javax.swing.JLabel();
        jLabelCh2 = new javax.swing.JLabel();
        jLabelCh3 = new javax.swing.JLabel();
        jLabelCh4 = new javax.swing.JLabel();
        jPanelRest = new javax.swing.JPanel();
        jButtonReset = new javax.swing.JButton();
        jButtonVoice = new javax.swing.JButton();
        jLabelCh = new javax.swing.JLabel();
        jPanelSet = new javax.swing.JPanel();
        jButtonSetparam = new javax.swing.JButton();
        jButtonDisplay = new javax.swing.JButton();
        jButtonHistroy = new javax.swing.JButton();
        jLayeredPaneSet = new javax.swing.JLayeredPane();
        jPanelSetParam = new javax.swing.JPanel();
        jLabelSet = new javax.swing.JLabel();
        jButtonHardware = new javax.swing.JButton();
        jButtonAdjust = new javax.swing.JButton();
        jButtonRelay = new javax.swing.JButton();
        jButtonLink = new javax.swing.JButton();
        jButtonFactory = new javax.swing.JButton();
        jButtonPassword = new javax.swing.JButton();
        jPanelHistory = new javax.swing.JPanel();
        jLabelHistory = new javax.swing.JLabel();
        jButtonTemperature = new javax.swing.JButton();
        jButtonAlarm = new javax.swing.JButton();
        jButtonExit = new javax.swing.JButton();

        jPopupMenu1.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 36)); // NOI18N

        jMenuItem3.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 36)); // NOI18N
        jMenuItem3.setText("jMenuItem3");
        jPopupMenu1.add(jMenuItem3);

        jMenuItem4.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 36)); // NOI18N
        jMenuItem4.setText("jMenuItem4");
        jPopupMenu1.add(jMenuItem4);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 12)); // NOI18N
        setMaximumSize(new java.awt.Dimension(1024, 600));
        setMinimumSize(new java.awt.Dimension(1024, 600));
        setName("MainFrame"); // NOI18N
        setPreferredSize(new java.awt.Dimension(1024, 600));
        setResizable(false);
        setSize(new java.awt.Dimension(1024, 600));
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jButtonStop.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jButtonStop.setText("停止采集");
        jButtonStop.setToolTipText("");
        jButtonStop.setMaximumSize(new java.awt.Dimension(105, 50));
        jButtonStop.setMinimumSize(new java.awt.Dimension(105, 50));
        jButtonStop.setPreferredSize(new java.awt.Dimension(105, 50));
        jPanelControl.add(jButtonStop);

        jButtonStart.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jButtonStart.setText("开始采集");
        jButtonStart.setPreferredSize(new java.awt.Dimension(105, 50));
        jPanelControl.add(jButtonStart);

        getContentPane().add(jPanelControl, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, 110, 110));

        jTableAlarm.setBackground(new java.awt.Color(240, 240, 240));
        jTableAlarm.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "通道", "分区", "位置", "报警种类", "报警时间", "报警描述"
            }
        ));
        jScrollPaneAlarm.setViewportView(jTableAlarm);

        getContentPane().add(jScrollPaneAlarm, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 120, 900, 390));

        jLabelCh1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bygf/dts/image/green1.png"))); // NOI18N

        jLabelCh2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bygf/dts/image/red2.png"))); // NOI18N

        jLabelCh3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bygf/dts/image/yellow3.png"))); // NOI18N

        jLabelCh4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bygf/dts/image/gray4.png"))); // NOI18N

        javax.swing.GroupLayout jPanelChLayout = new javax.swing.GroupLayout(jPanelCh);
        jPanelCh.setLayout(jPanelChLayout);
        jPanelChLayout.setHorizontalGroup(
            jPanelChLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelChLayout.createSequentialGroup()
                .addGap(69, 69, 69)
                .addComponent(jLabelCh1)
                .addGap(110, 110, 110)
                .addComponent(jLabelCh2)
                .addGap(124, 124, 124)
                .addComponent(jLabelCh3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabelCh4)
                .addGap(44, 44, 44))
        );
        jPanelChLayout.setVerticalGroup(
            jPanelChLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelChLayout.createSequentialGroup()
                .addGroup(jPanelChLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelCh2)
                    .addComponent(jLabelCh1)
                    .addComponent(jLabelCh3)
                    .addComponent(jLabelCh4))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(jPanelCh, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 40, 760, 70));

        jButtonReset.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jButtonReset.setText("复位");
        jButtonReset.setToolTipText("");
        jButtonReset.setMaximumSize(new java.awt.Dimension(105, 50));
        jButtonReset.setMinimumSize(new java.awt.Dimension(105, 50));
        jButtonReset.setPreferredSize(new java.awt.Dimension(105, 50));
        jPanelRest.add(jButtonReset);

        jButtonVoice.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jButtonVoice.setText("消音");
        jButtonVoice.setToolTipText("");
        jButtonVoice.setMaximumSize(new java.awt.Dimension(105, 50));
        jButtonVoice.setMinimumSize(new java.awt.Dimension(105, 50));
        jButtonVoice.setPreferredSize(new java.awt.Dimension(105, 50));
        jPanelRest.add(jButtonVoice);

        getContentPane().add(jPanelRest, new org.netbeans.lib.awtextra.AbsoluteConstraints(900, 0, 120, 120));

        jLabelCh.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 24)); // NOI18N
        jLabelCh.setText("通道状态");
        getContentPane().add(jLabelCh, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 10, -1, -1));

        jButtonSetparam.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jButtonSetparam.setText("参数设置");
        jButtonSetparam.setToolTipText("");
        jButtonSetparam.setMaximumSize(new java.awt.Dimension(105, 50));
        jButtonSetparam.setMinimumSize(new java.awt.Dimension(105, 50));
        jButtonSetparam.setPreferredSize(new java.awt.Dimension(105, 50));
        jButtonSetparam.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSetparamActionPerformed(evt);
            }
        });
        jPanelSet.add(jButtonSetparam);

        jButtonDisplay.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jButtonDisplay.setText("曲线显示");
        jButtonDisplay.setToolTipText("");
        jButtonDisplay.setMaximumSize(new java.awt.Dimension(105, 50));
        jButtonDisplay.setMinimumSize(new java.awt.Dimension(105, 50));
        jButtonDisplay.setPreferredSize(new java.awt.Dimension(105, 50));
        jButtonDisplay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDisplayActionPerformed(evt);
            }
        });
        jPanelSet.add(jButtonDisplay);

        jButtonHistroy.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jButtonHistroy.setText("历史查询");
        jButtonHistroy.setToolTipText("");
        jButtonHistroy.setMaximumSize(new java.awt.Dimension(105, 50));
        jButtonHistroy.setMinimumSize(new java.awt.Dimension(105, 50));
        jButtonHistroy.setPreferredSize(new java.awt.Dimension(105, 50));
        jButtonHistroy.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonHistroyActionPerformed(evt);
            }
        });
        jPanelSet.add(jButtonHistroy);

        getContentPane().add(jPanelSet, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, 110, 170));

        jLayeredPaneSet.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N

        jPanelSetParam.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N

        jLabelSet.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jLabelSet.setText("参数设置");
        jPanelSetParam.add(jLabelSet);

        jButtonHardware.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 14)); // NOI18N
        jButtonHardware.setText("硬件参数");
        jButtonHardware.setPreferredSize(new java.awt.Dimension(89, 35));
        jButtonHardware.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonHardwareActionPerformed(evt);
            }
        });
        jPanelSetParam.add(jButtonHardware);

        jButtonAdjust.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 14)); // NOI18N
        jButtonAdjust.setText("校准参数");
        jButtonAdjust.setPreferredSize(new java.awt.Dimension(89, 35));
        jButtonAdjust.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAdjustActionPerformed(evt);
            }
        });
        jPanelSetParam.add(jButtonAdjust);

        jButtonRelay.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 14)); // NOI18N
        jButtonRelay.setText("继电器设置");
        jButtonRelay.setPreferredSize(new java.awt.Dimension(103, 35));
        jButtonRelay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRelayActionPerformed(evt);
            }
        });
        jPanelSetParam.add(jButtonRelay);

        jButtonLink.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 14)); // NOI18N
        jButtonLink.setText("联动设置");
        jButtonLink.setPreferredSize(new java.awt.Dimension(89, 35));
        jButtonLink.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLinkActionPerformed(evt);
            }
        });
        jPanelSetParam.add(jButtonLink);

        jButtonFactory.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 14)); // NOI18N
        jButtonFactory.setText("出厂设置");
        jButtonFactory.setPreferredSize(new java.awt.Dimension(89, 35));
        jButtonFactory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonFactoryActionPerformed(evt);
            }
        });
        jPanelSetParam.add(jButtonFactory);

        jButtonPassword.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 14)); // NOI18N
        jButtonPassword.setText("修改密码");
        jButtonPassword.setPreferredSize(new java.awt.Dimension(89, 35));
        jButtonPassword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPasswordActionPerformed(evt);
            }
        });
        jPanelSetParam.add(jButtonPassword);

        jLayeredPaneSet.add(jPanelSetParam);
        jPanelSetParam.setBounds(0, 0, 110, 320);

        jPanelHistory.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N

        jLabelHistory.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jLabelHistory.setText("报警历史");
        jPanelHistory.add(jLabelHistory);

        jButtonTemperature.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 14)); // NOI18N
        jButtonTemperature.setText("温度历史");
        jButtonTemperature.setPreferredSize(new java.awt.Dimension(89, 40));
        jPanelHistory.add(jButtonTemperature);

        jButtonAlarm.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 14)); // NOI18N
        jButtonAlarm.setText("报警历史");
        jButtonAlarm.setPreferredSize(new java.awt.Dimension(89, 40));
        jPanelHistory.add(jButtonAlarm);

        jLayeredPaneSet.add(jPanelHistory);
        jPanelHistory.setBounds(0, 0, 110, 320);

        getContentPane().add(jLayeredPaneSet, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 280, 110, 320));

        jButtonExit.setFont(new java.awt.Font("文泉驿等宽微米黑", 0, 18)); // NOI18N
        jButtonExit.setText("退出");
        jButtonExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonExitActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonExit, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 0, -1, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonSetparamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSetparamActionPerformed
        // TODO add your handling code here:
        jPanelSetParam.setVisible(true);
        jPanelHistory.setVisible(false);
    }//GEN-LAST:event_jButtonSetparamActionPerformed

    private void jButtonHistroyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonHistroyActionPerformed
        // TODO add your handling code here
        jPanelHistory.setVisible(true);
        jPanelSetParam.setVisible(false);
        
    }//GEN-LAST:event_jButtonHistroyActionPerformed

    private void jButtonHardwareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonHardwareActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonHardwareActionPerformed

    private void jButtonAdjustActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAdjustActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonAdjustActionPerformed

    private void jButtonRelayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRelayActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonRelayActionPerformed

    private void jButtonLinkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLinkActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonLinkActionPerformed

    private void jButtonFactoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFactoryActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonFactoryActionPerformed

    private void jButtonPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPasswordActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonPasswordActionPerformed

    private void jButtonDisplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDisplayActionPerformed
        // TODO add your handling code here:
        new CurveJFrame().setVisible(true);
    }//GEN-LAST:event_jButtonDisplayActionPerformed

    private void jButtonExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonExitActionPerformed
        // TODO add your handling code here:
        dispose();
        System.exit(0);
    }//GEN-LAST:event_jButtonExitActionPerformed

    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(MainJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(MainJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(MainJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(MainJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new MainJFrame().setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonAdjust;
    private javax.swing.JButton jButtonAlarm;
    private javax.swing.JButton jButtonDisplay;
    private javax.swing.JButton jButtonExit;
    private javax.swing.JButton jButtonFactory;
    private javax.swing.JButton jButtonHardware;
    private javax.swing.JButton jButtonHistroy;
    private javax.swing.JButton jButtonLink;
    private javax.swing.JButton jButtonPassword;
    private javax.swing.JButton jButtonRelay;
    private javax.swing.JButton jButtonReset;
    private javax.swing.JButton jButtonSetparam;
    private javax.swing.JButton jButtonStart;
    private javax.swing.JButton jButtonStop;
    private javax.swing.JButton jButtonTemperature;
    private javax.swing.JButton jButtonVoice;
    private javax.swing.JLabel jLabelCh;
    private javax.swing.JLabel jLabelCh1;
    private javax.swing.JLabel jLabelCh2;
    private javax.swing.JLabel jLabelCh3;
    private javax.swing.JLabel jLabelCh4;
    private javax.swing.JLabel jLabelHistory;
    private javax.swing.JLabel jLabelSet;
    private javax.swing.JLayeredPane jLayeredPaneSet;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JPanel jPanelCh;
    private javax.swing.JPanel jPanelControl;
    private javax.swing.JPanel jPanelHistory;
    private javax.swing.JPanel jPanelRest;
    private javax.swing.JPanel jPanelSet;
    private javax.swing.JPanel jPanelSetParam;
    private javax.swing.JPopupMenu jPopupMenu1;
    private javax.swing.JScrollPane jScrollPaneAlarm;
    private javax.swing.JTable jTableAlarm;
    // End of variables declaration//GEN-END:variables
}
